package day240607.hw;

import java.lang.reflect.Constructor;

public class MyReflectionUtil {
    public static <T> T getInstance(String clazz) {
        T dl;
        try {
            Class<?> downloaderClass = Class.forName(clazz);
            Constructor<?> declaredConstructor = downloaderClass.getDeclaredConstructor();
            dl = (T) declaredConstructor.newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return dl;
    }
}